#include<iostream>
#include<cstring>
using namespace std;

const int N = 25;
char str1[N];
char str2[N];

int main()
{
	cin >> str1 >> str2;
	if (strstr(str1, str2))
		cout << str2 << " is substring of " << str1 << endl;
	else if (strstr(str2, str1))
		cout << str1 << " is substring of " << str2 << endl;
	else
		cout << "No substring" << endl;
	
	return 0;
}
